package demo2;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 石方旭
 * Date: 2022-04-07
 * Time: 20:03
 */
class Shape{//创建一个图形类---->作为多种图形的父类
    public int length;//图形的长
    public int wide;//图形的宽
    public int height;//图形的高
    public void draw() {
        System.out.println("我要画一个图形！！！");
    }
}
class rectangle extends Shape{//长方形
    @Override
    public void draw() {
        System.out.println("我要画一个长方形！！！");
    }
}
class square extends Shape{
    @Override
    public void draw() {
        System.out.println("我要画一个正方形！！！");
    }
}
class circular extends Shape{
    @Override
    public void draw() {
        System.out.println("我要画一个圆形！！！");
    }
}
public class TestDemo1 {
    public static void method(Shape shape) {
        shape.draw();
    }
    public static void main(String[] args) {
        Shape shape1 = new circular();
        Shape shape2 = new rectangle();
        Shape shape3 = new square();
        method(shape1);
        method(shape2);
        method(shape3);
    }
}
